package com.intcast;

import java.util.Scanner;

/*
要写注释哦!!!
*/
public class Demo05 {
    public static void main(String[] args) {
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个分数：");
            arr[i]=sc.nextInt();
        }
        double min = minScore(arr);
        double max = maxScore(arr);
        double sum = sumScore(arr);
        double resoult = (sum - max - min)*1.0 / (arr.length - 2);
        System.out.println("选手的最终得分为：" + resoult);
    }

    public static double minScore(int[] arr) {
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        return min;
    }

    public static double maxScore(int[] arr) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max > arr[i]) {
                max = arr[i];
            }
        }
        return max;
    }

    //和
    public static double sumScore(int[] arr) {
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        return sum;
    }
}

